#pragma once
#include <cstdint>
#include <memory>
#include "axisgroup/fsm.h"
namespace axisgroup {
class AxisGroup;
class FsmBooting : public FsmItf
{
public:
    static const uint32_t WATCHDOG_TIMEOUT_MS = 30000;

public:
    FsmBooting(AxisGroup* grp);
    void update(bool first = false);
    void reset();

    virtual bool check_all_axis_ready();
    virtual int sync_boot_data();
    virtual int sync_dh_data();
    virtual int sync_dyna_data();
    int check_watchdog();
    virtual void timeout_action();

    AxisGroup* grp_;  //因为各个fsm仅包含在一个axisgroup中且生命周期相同，所以这里不需要shared_ptr

    int boot_stat_;

    int watchdog_cnt_ = WATCHDOG_TIMEOUT_MS;

    bool is_timeout_;

private:
    bool check_robot_param_CRC(int type);
};
}  // namespace axisgroup
